﻿<Window x:Class="GMusicUtil.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" WindowState="Maximized" Height="768" Width="1024">
    <Window.Resources>
        <Style x:Key="ProcessingVisibilityStyle" TargetType="{x:Type FrameworkElement}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=IsProcessingFiles, Mode=OneWay}" Value="True">
                    <Setter Property="Visibility" Value="Visible"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" MinHeight="50"/>
            <RowDefinition Height="Auto" MinHeight="50"/>
            <RowDefinition Height="Auto" MinHeight="50"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>

        <TextBox Grid.Row="0" Grid.Column="0" x:Name="mp3DirectoryInput" Text="{Binding Path=Mp3Directory, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center"/>
        <Button Grid.Row="0" Grid.Column="1" Margin="5,0,0,0" Padding="5" Content="Browse For Mp3 Directory..." Click="Mp3DirectoryBrowseClick"/>
        <Button Grid.Row="0" Grid.Column="2" Margin="5,0,5,0" Padding="5" Content="Load..." Command="{Binding Path=LoadFilesCommand, Mode=OneTime}"/>
        <ProgressBar Grid.Row="0" Grid.Column="3" Width="200" Minimum="0" Maximum="1" Value="{Binding Path=FileLoadProgress, Mode=OneWay}"/>
        <TextBlock Grid.Row="0" Grid.Column="3" Text="{Binding Path=FileLoadStatus, Mode=OneWay}" HorizontalAlignment="Center" VerticalAlignment="Center"/>

        <TextBox Grid.Row="1" Grid.Column="0" x:Name="databasePathInput" Text="{Binding Path=DatabasePath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center"/>
        <Button Grid.Row="1" Grid.Column="1" Margin="5,0,0,0" Padding="5" Content="Browse For music.db File..." Click="DatabaseBrowseClick"/>
        <Button Grid.Row="1" Grid.Column="2" Margin="5,0,5,0" Padding="5" Content="Load..." Command="{Binding Path=LoadEntitiesCommand, Mode=OneTime}"/>
        <ProgressBar Grid.Row="1" Grid.Column="3" Width="200" Minimum="0" Maximum="1" Value="{Binding Path=EntityLoadProgress, Mode=OneWay}"/>
        <TextBlock Grid.Row="1" Grid.Column="3" Text="{Binding Path=EntityLoadStatus, Mode=OneWay}" HorizontalAlignment="Center" VerticalAlignment="Center"/>

        <Button Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4" Margin="0,5,0,0" Content="{Binding Path=ProcessStatus, Mode=OneWay}" Command="{Binding Path=UpdateFilesCommand, Mode=OneTime}"/>
        <ProgressBar Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4" Margin="0,5,0,0" Minimum="0" Maximum="1" Value="{Binding Path=ProcessProgress, Mode=OneWay}" Visibility="Hidden" Style="{StaticResource ProcessingVisibilityStyle}"/>
        <TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4" Margin="0,5,0,0" Text="{Binding Path=ProcessStatus, Mode=OneWay}" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Hidden" Style="{StaticResource ProcessingVisibilityStyle}"/>
        
        <TextBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" x:Name="logDisplay" Margin="0,5,0,0" TextWrapping="Wrap" IsReadOnly="True" 
                 Text="{Binding Path=LogText, Mode=OneWay}" VerticalScrollBarVisibility="Auto" TextChanged="LogTextChanged"/>
    </Grid>
</Window>
